#include <windows.h>

class XgBitmap
{
public:
	XgBitmap();
	~XgBitmap();

public:
	bool attach( HMODULE hMod, UINT resourceId );
	bool attach( HANDLE hBitmap );

	bool isValid();

	int width();
	int height();

	bool paint( HDC dc, LPRECT lpDstRect = 0, LPRECT lpSrcRect = 0);
	bool paint( HDC dc, ULONG dstX, ULONG dstY, ULONG srcX, ULONG srcY, ULONG srcW = 0, ULONG srcH = 0);
	
	bool paintMasked( HDC dc, HMODULE hMod, UINT resourceId );
	bool paintMasked( HDC dc, HBITMAP hbmMask );

	bool paintAlpha( HDC dc, UINT alpha );

private:
	HANDLE _hBitmap;
	DIBSECTION _dibSection;
};
